<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
 
<div id="app">
    <!-- 这里的isShow取得是app里的isShow的值,不会取到cpn1里面的isShow的值 -->
    <cpn1 v-show="isShow"></cpn1>
</div>

<template id="cpn1">
    <div>
        <h2>我是子组件</h2>
        <p>我是内容</p>
        <!-- 这里的isShow取得是cpn1里的isShow的值 -->
        <button v-show="isShow">按钮</button>
    </div>
</template>

<script src="../js/vue.js"></script>
<script>
    const app = new Vue({
        el: '#app',
        data() {
            return {
                message: 'Hello',
                isShow: true
            }
        },
        components: {
            cpn1: {
                template: '#cpn1',
                data() {
                    return {
                        isShow: false
                    }
                }
            }
        }
    })
</script>
</body>
</html>